import Taro from '@tarojs/taro';
import { AtNavBar } from 'taro-ui';
import PropTypes from 'prop-types';

const navBar = (props: any) => {
  const handleLeftClick = () => {
    window.history.go(-1);
  };
  return (
    <AtNavBar
      onClickLeftIcon={() => handleLeftClick()}
      leftIconType="chevron-left"
      color="#000"
      title={props.title}
      leftText="返回"
    />
  );
};

navBar.defaultProps = {
  title: '默认标题',
};
// eslint-disable-next-line react/no-typos
navBar.PropTypes = {
  title: PropTypes.string.isRequired,
};

export default navBar;
